import request from '@/axios'
import { RoleTypeType } from './types'

//分页获取角色类型
export const pageApi = (data) => {
  return request.post({ url: '/rbac-server/rbac/roletype/page', data })
}

//新增角色类型
export const addApi = (data) => {
  return request.post({ url: '/rbac-server/rbac/roletype/add', data })
}
//获取角色类型
export const getApi = (params) => {
  return request.get({ url: '/rbac-server/rbac/roletype/get', params })
}
//删除角色类型
export const delApi = (code) => {
  return request.delete({ url: '/rbac-server/rbac/roletype/delete', params: { code } })
}
//修改角色类型
export const updateApi = (data) => {
  return request.put({ url: '/rbac-server/rbac/roletype/update', data })
}

//排序
export const sortApi = (params) => {
  return request.put({ url: '/rbac-server/rbac/roletype/sort', params })
}

//获取启用的角色类型
export const listRoleTypeApi = (orgId?: string): Promise<IResponse<RoleTypeType[]>> => {
  return request.get({ url: '/rbac-server/rbac/roletype/list', params: { orgId } })
}
